How to handle table control in BDC?
Answers were Sorted based on User's Feedback
Answer / rubal taneja
Regarding Table comtrols in BDC...
Normally all the screns with table controls will have buttons to add(Insert) a Row, Delete a Row etc..
After adding data to 1st Row (it will have index 1)... press that insert button so a new Row is inserted again at 1st row..so this will have index 1.
So in this way you can hard code the index to one.
The advantage is that if there are many rows then you will not have to keep a track of how many rows are inserted and when to press the page down button.
I am giving a small example.... Just copy paste this example and run it in all mode...
Run it in all mode so that you can see what I am trying to do...
Note : this is an relatively easy method.. not the only method to do...
**********************************************
report ZTEST_BDC
no standard page heading line-size 255.
include bdcrecx1.
start-of-selection.
perform open_group.
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_CURSOR'
'RSRD1-DDTYPE'.
perform bdc_field using 'BDC_OKCODE'
'=CHANGE_RADIO'.
perform bdc_field using 'RSRD1-TBMA'
''.
perform bdc_field using 'RSRD1-TBMA_VAL'
'EKPO'.
perform bdc_field using 'RSRD1-DDTYPE'
'X'.
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_CURSOR'
'RSRD1-DDTYPE_VAL'.
perform bdc_field using 'BDC_OKCODE'
'=ADD'.
perform bdc_field using 'RSRD1-TBMA_VAL'
'EKPO'.
perform bdc_field using 'RSRD1-DDTYPE'
'X'.
perform bdc_field using 'RSRD1-DDTYPE_VAL'
'ztest_Str'.
perform bdc_dynpro using 'SAPLSED1' '0100'.
perform bdc_field using 'BDC_CURSOR'
'D_100-STRU'.
perform bdc_field using 'BDC_OKCODE'
'=GOON'.
perform bdc_field using 'D_100-DTEL'
''.
perform bdc_field using 'D_100-STRU'
'X'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-FIELDNAME(01)'.
perform bdc_field using 'DD03P_D-FIELDNAME(01)'
'bukrs'.
perform bdc_field using 'DD03P_D-ROLLNAME(01)'
'bukrs'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'=WB_LINE_INSERT'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-FIELDNAME(01)'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-ROLLNAME(01)'.
perform bdc_field using 'DD03P_D-FIELDNAME(01)'
'kostl'.
perform bdc_field using 'DD03P_D-ROLLNAME(01)'
'kostl'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'=WB_LINE_INSERT'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-FIELDNAME(01)'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-ROLLNAME(01)'.
perform bdc_field using 'DD03P_D-FIELDNAME(01)'
'wrbtr'.
perform bdc_field using 'DD03P_D-ROLLNAME(01)'
'wrbtr'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'=WB_SAVE'.
perform bdc_field using 'DD02D-DDTEXT'
'test'.
perform bdc_field using 'BDC_CURSOR'
'DD03P_D-ROLLNAME(01)'.
perform bdc_dynpro using 'SAPLSTRD' '0100'.
perform bdc_field using 'BDC_CURSOR'
'KO007-L_DEVCLASS'.
perform bdc_field using 'BDC_OKCODE'
'=TEMP'.
perform bdc_field using 'KO007-L_AUTHOR'
'VARUN'.
perform bdc_dynpro using 'SAPLSD41' '2100'.
perform bdc_field using 'BDC_OKCODE'
'/EWB_CANCEL'.
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_OKCODE'
'/EABR'.
perform bdc_field using 'BDC_CURSOR'
'RSRD1-DDTYPE_VAL'.
perform bdc_transaction using 'SE11'.
perform close_group.
****************************************************
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / narasimha reddy
Bdc Approach is Screen and function code interface.
When enter the screen we required enter multiple Data
same screen.
example va01. at enter qty and material fields. if system allowed only Limited entries. after press enter system allocated some entries. finally save button.
This logic recorded in SHDB Transaction.
loop at it_vbap into wa_vbap.
concatenate 'VBAP-AMTNR(' V1 ')' Into field.
perform sub_fld v1 wa_vbap-matnr.
" we assum system allowed 5 entries after enter data again 5 fields allowed.
v1 = v1 + 1.
if v1 = 6.
v1 = 1.
perform sub USING 'BDC_OKCODE. '00/'.
PERFORM SUB1 USING 'SAPMV45A' '4100' 'X'.
perform sub USING 'BDC_OKCODE. '00/'.
endloop.
ABOVE CODE FOR SAMPLE .
Is This Answer Correct ? | 0 Yes | 0 No |
with out doing any action how to go another screen ,means when ever control comes to that particular field this action has to be done?
2 Answers Bristle Cone, Cap Gemini, HP, Satyam, Wipro,
please any one can tell me How to validate the data in Table maintinance generator?how can u validate the table field values if u r entering the data into fields .it shows record is wrong?wher we can done validation in table maitenance generator before getting the data as out ?
Search help exit details.
How do you process errors in session method ? : abap bdc
Where do you use help views?
How table control cn be generated using bdc? : abap bdc
How to delete the field created using APPEND STRUCTURE (.APPEND)
what is Import and Export Memory?
How to add more than one message to one idoc? Tell me Process
in ALV reports how double click event works?
What is the difference between getting and get late?
one client needs material description more than 40 chars so how can we extend because in standard table material descp is of 40 chars only