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 |
could anyone tell me what r real time questions been asked in interviews?i am in urgent need..thanks in advance
What is the diff b/w load of program and Initailazatio Events? Which event triggers each time we exectute the program?
types of smartforms? windows in smartforms?
What is meant by payscale structure? How did you configure pay scale structure? : sap abap hr
what is the work of buffer in sap ?
What are the different window types in sapscript?
What are ranges? What are number ranges?
1 must be expert in JAVA to learn SAP-ABAP?
What's the difference between AT NEW and AT END OF events?
i have a requirement that design window in layout of smartforms but when we print smartforms window should not be printed?
Why do we use types statement in abap programming?
What is the exact difference between pooled table and cluster table and explain with examples?